<template>
  <div >
    <el-dialog :visible.sync="detailData.isShow" width="800px"  title='查看详情' 
    :close-on-click-modal="false"
    @open="openBranch"
    >
    <div v-loading="loading">
      <el-card style='overflow:visible'>
        <div slot="header" class="clearfix">
          <span>上级机构</span>
        </div>
        <el-form ref="branchformFather" :model="branch" size="mini" label-width="90px" label-position="left">
          <el-row :gutter="20">
            <el-col :span="12">  
              <el-form-item label="法人行号:"  prop="legalpersonnum">
                <span>{{branch.legalpersonnum}}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12" >  
            <el-form-item label="分行号:" prop="zonenum">
              <span>{{branch.zonenum}}</span>
              </el-form-item>
            </el-col>
            <el-col :span='12' >  
            <el-form-item label="上级机构号:" prop="supebranchnum">
              <span>{{branch.supebranchnum}}</span>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-card >
      <el-card style='margin-top:10px;'>
        <div slot="header" class="clearfix">
          <span>机构信息</span>
        </div>
        <el-form ref="branchform" :model="branch" size="mini" label-width="115px" label-position="left">
          <el-row :gutter="20">
            <el-col :span="12">  
               <el-form-item label="机构号:"  prop="branchnum">
                <span>{{branch.branchnum}}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12" >  
            <el-form-item label="机构名称:" prop="branchname">
              <span>{{branch.branchname}}</span>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span='12' >  
              <el-form-item label="机构简称:" prop="branchabbr">
                <span>{{branch.branchabbr}}</span>
              </el-form-item>
            </el-col>
             <el-col :span='12' >  
              <el-form-item label="机构属性:" prop="branchattr">
                <span>{{formateData(brnoProp,branch.branchattr)}}</span>        
              </el-form-item>
            </el-col>
          </el-row>
           <el-row :gutter="20">
            <el-col :span='12' >  
              <el-form-item label="机构级别:" prop="branchlevel">
                <span>{{formateData(brnoLevel,branch.branchlevel)}}</span>        
              </el-form-item>
            </el-col>
            <el-col :span='12' >  
              <el-form-item label="机构负责人:" prop="branchpersonincharge">
                <span>{{branch.branchpersonincharge}}</span>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span='12' >  
            
              <el-form-item label="负责人电话:" prop="personinchargecontactphone">
                <span>{{branch.personinchargecontactphone}}</span>
              </el-form-item>
            </el-col>
             <el-col :span='12' >  
              <el-form-item label="金融许可证:" prop="finapermit">
                <span>{{branch.finapermit}}</span>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span='12' >  
              <el-form-item label="经度:" prop="gpscoor_long">
                <span>{{branch.gpscoor_long}}</span>
              </el-form-item>
            </el-col>
             <el-col :span='12' >  
              <el-form-item label="纬度:" prop="gpscoor_lati">
                <span>{{branch.gpscoor_lati}}</span>
              </el-form-item>
            </el-col>
          </el-row>
           <el-row :gutter="20">
            <el-col :span='12' >  
              <el-form-item label="机构联系人姓名:" prop="branchcontactname">
                <span>{{branch.branchcontactname}}</span>
              </el-form-item>
            </el-col>
             <el-col :span='12' >  
              <el-form-item label="机构联系人电话:" prop="branchcontactphone">
                <span>{{branch.branchcontactphone}}</span>
              </el-form-item>
            </el-col>
          </el-row>
           <el-row :gutter="20">
               <el-col :span="12">
                <el-form-item label='开业日期:' prop='dateopen'>
                  <span>{{toolBox.timeFormat2Date(branch.dateopen)}}</span>
                </el-form-item>
               </el-col>
               <el-col :span="12">
                <el-form-item label='生效日期:' prop='effedate'>
                  <span>{{toolBox.timeFormat2Date(branch.effedate)}}</span>
                </el-form-item>
               </el-col>
            </el-row>
            <el-row :gutter="20">
               <el-col :span="12">
                <el-form-item label='失效日期:' prop='expidate'>
                  <span>{{toolBox.timeFormat2Date(branch.expidate)}}</span>
                </el-form-item>
               </el-col>
               <el-col :span="12">
                <el-form-item label='机构IP检查标志:' prop='branchipcheckmark'>
                  <span>{{formateData(checkMark,branch.branchipcheckmark)}}</span>
                </el-form-item>
               </el-col>
            </el-row>
            <el-row :gutter="20">
            <el-col :span='24' >  
              <el-form-item label="交通信息:" prop="trafficinfo">
                <span>{{branch.trafficinfo}}</span>
              </el-form-item>
            </el-col>
             <el-col :span='24' >  
              <el-form-item label="地址:" prop="branchaddr">
                <span>{{branch.branchaddr}}</span>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-card >
      <el-row style="margin:20px 0;text-align:right">
        <el-button size="mini" @click="detailData.isShow=false" type="primary">确认</el-button>                        
      </el-row>
    </div>
    </el-dialog>
  </div>
</template>
<script>
import getGlobalParams from "@/common/utils/getGlobalParams";
import toolBox from "@/common/utils/toolBox";

export default {
  props: { detailData: Object },
  data() {
    return {
      brnoList:[],
      brnoListFather:[],      
      brnoLevel:[],
      checkMark:[
        {value:"0",label:"0-关闭"},
        {value:"1",label:"1-开启"}
      ],//检查标志
      loading: false, 
      // branchInfo: [],
      brnoProp: [],
      branch: {
        branchnum: "",
        branchname: "",
        branchabbr: "",
        branchattr: "",
        branchlevel: "",
        finapermit: "",
        gpscoor_lati: "",
        gpscoor_long: "",
        branchaddr: "",
        branchpersonincharge: "",
        personinchargecontactphone: "",
        branchcontactname:"",
        branchcontactphone:"",
        dateopen: "",
        effedate: "",
        expidate: "",
        branchipcheckmark:"",
        trafficinfo:"",
        supebranchnum:"",
        zonenum:"",
        legalpersonnum:""
      },
    };
  },
  created() {
    this.brnoProp = getGlobalParams.get("brnoProp");
    this.brnoLevel= getGlobalParams.get("brnoLevel");
  },
  methods: {
    formateData(arr,val){
      let value=""
      arr.forEach(element => {
        if (val==element.value) {
          value=element.label;
          // break;
        }
      });
      return value
    },
    openBranch() {
      this.branch=JSON.parse(JSON.stringify(this.detailData.currentRow)) ;
      // this.branch.branchattr=this.formateData(this.brnoProp,this.branch.branchattr)
    },
  }
};
</script>
